﻿using DAL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public class ShopBLL
    {
        public ShopDAL ShopDAL { get; }

        public ShopBLL(ShopDAL shopDAL)
        {
            ShopDAL = shopDAL;
        }
        /// <summary>
        /// 添加门店
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int ShopAdd(ShopModel info)
        {
            try
            {
               return ShopDAL.ShopAdd(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int ShopDelete(int id)
        {
            try
            {
                return ShopDAL.ShopDelete(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int ShopDeleteAll(string ids)
        {
            try
            {
               return ShopDAL.ShopDeleteAll(ids);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批量修改状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int ShopUpdateAll(string ids, int state)
        {
            try
            {
               return ShopDAL.ShopUpdateAll(ids, state);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// id查询(反填)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ShopModel GetShopId(int id)
        {
            try
            {
               return ShopDAL.GetShopId(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 修改门店信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int ShopUpdate(ShopModel info)
        {
            try
            {
               return ShopDAL.ShopUpdate(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示查询分页
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="totalPage"></param>
        /// <param name="pageindex"></param>
        /// <param name="pageSize"></param>
        /// <param name="ShopName"></param>
        /// <param name="Scope"></param>
        /// <returns></returns>
        public List<ShopModel> GetShopList(out int totalCount, out int totalPage, int pageindex = 1, int pageSize = 2, string? ShopName = "", int? Scope = null)
        {
            try
            {
               return ShopDAL.GetShopList(out totalCount, out totalPage, pageindex, pageSize, ShopName, Scope);

            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
